﻿using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Simple.Framework;
using Simple.Tools;
using SimpleNet.Handle;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

/*********************************************************
 * 命名空间 SimpleNet.example.Handle
 * 接口名称 Testhandle
 * 开发人员：ADMIN
 * 创建时间：2023/12/18 10:26:04
 * 描述说明：
 * 更改历史：
 * 
 * *******************************************************/
namespace SimpleNet.example.Handle
{
	[NumberRange(0x10,0x20)]
	internal class Testhandle:BaseHandle
	{
		[Autowired]
		protected ILogger<Testhandle> logger { get; set; }
		public Testhandle()
		{

		}
		[MessageNumber(0x18)]
		public async Task TestReceiveMesage()
		{
			//logger.LogInformation("接受消息!");

			byte[] data = new byte[context.CurrentPack.Length];
			Array.Copy(context.CurrentPack.ReceiveBuffer,3,data,0,data.Length);
			string message=Encoding.UTF8.GetString(data);

			logger.LogInformation(context.ConnectionId+"接收到的消息:"+message);
		}
	}
}
